/**
 * 
 */
package cn.softTank.BpelModelImpl;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import cn.softTank.BpelModel.Link;
import cn.softTank.BpelModel.Source;
import cn.softTank.BpelModel.TransitionCondition;

/**
 * @author Yuzone (smartzxy@gmail.com)
 *
 */
public class SourceImpl implements Source {

	private Link link;
	private TransitionCondition transitionCondition;
	
	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.Source#getLink()
	 */
	@Override
	public Link getLink() {
		return this.link;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.Source#getTransitionCondition()
	 */
	@Override
	public TransitionCondition getTransitionCondition() {
		return transitionCondition;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.Source#setLink(cn.softTank.BpelModel.Link)
	 */
	@Override
	public void setLink(Link value) {
		link=value;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.Source#setTransitionCondition(cn.softTank.BpelModel.TransitionCondition)
	 */
	@Override
	public void setTransitionCondition(TransitionCondition transitionCondition) {
		this.transitionCondition=transitionCondition;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.XmlAdapt#toElement()
	 */
	@Override
	public Element toElement() {
		Element e=DocumentHelper.createElement("source");
		if(link!=null)
			e.addAttribute("linkName", link.getName());
		if(transitionCondition!=null)
			e.add(transitionCondition.toElement());
		return e;
	}

	/* (non-Javadoc)
	 * @see cn.softTank.BpelModel.XmlAdapt#toXml()
	 */
	@Override
	public String toXml() {
		// TODO Auto-generated method stub
		return null;
	}

}
